package com.cloudblog.ai.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cloudblog.common.pojo.DoMain.AiChat;
import com.cloudblog.common.pojo.DoMain.Conversation;
import com.cloudblog.common.pojo.Dto.AiChatDetail;
import com.cloudblog.common.pojo.Dto.AiChatList;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public interface AiMapper extends BaseMapper<AiChat> {

    /**
     * 创建会话
     * @param conversationId
     */
    void createConversation(@Param("userId") Long userId, @Param("conversationId") String conversationId);

    /**
     * 获取会话列表
     * @param userId
     * @return
     */
    List<AiChatList> getChatList(Long userId);

    /**
     * 获取会话详情
     * @param conversationId
     * @return
     */
    List<AiChatDetail> getChatDetail(String conversationId);

    /**
     * 获取会话
     * @param conversationId
     * @return
     */
    Conversation getChatByConversationId(String conversationId);

    /**
     * 删除会话
     * @param conversationId
     */
    void deleteConversation(String conversationId);

    /**
     * 保存用户消息(简洁版)
     * @param userId
     * @param conversationId
     * @param message
     * @param file
     */
    void saveUserMessage(
            Long userId,
            @Param("conversationId") String conversationId,
            @Param("content") String message,
            @Param("file") String file
    );

    /**
     * 保存AI消息(简洁版)
     * @param userId
     * @param conversationId
     * @param content
     */
    void saveAssistantMessage(
            Long userId,
            @Param("conversationId") String conversationId,
            @Param("content") String content);

    /**
     * 删除会话消息
     * @param conversationId
     */
    void deleteChatMessages(String conversationId);
}
